package main

import (
	"github.com/howeyc/fsnotify"
	"log"
	"shortUrl/app"
)

func init() {
	//watchFiles()
}
func main() {
	env := app.GetEnv()
	app := app.App{}
	app.Initialize(env)
	app.Run(":9051")
}

func watchFiles() {
	watcher, err := fsnotify.NewWatcher()
	if err != nil {
		log.Fatalln(err)
	}
	done := make(chan bool)

	go func() {
		for {
			select {
			case ev := <-watcher.Event:
				log.Println("event:", ev)
			case err := <-watcher.Error:
				log.Println("error:", err)

			}
		}
	}()

	err = watcher.Watch("app")
	if err != nil {
		log.Fatalln(err)
	}
	<-done
	watcher.Close()
}
